package com.hos.net.req.art;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.hos.db.create.art.ArticleContentEntity;
import com.hos.net.req.BaseReq;
import com.hos.net.res.MsgHint;

import java.util.List;

/**
 * 创建文章
 * Created by guom on 2018/10/27.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ArtCreateReq extends BaseReq {
    //文章标题
    public String artTitle;
    //文章封面
    public String artImgCover;
    //文章内容
    public List<ArticleContentEntity> artContents;
    @JsonIgnore
    public String hint;

    // (false 检验失败)
    @JsonIgnore
    public boolean isVerifyParameter() {
        if (artTitle == null || artTitle == "") {
            hint = new MsgHint("文章标题不能为空").toJson();
            return false;
        }
        if (artContents == null || artContents.size() == 0) {
            hint = new MsgHint("文章内容不能为空").toJson();
            return false;
        }
        return true;
    }

}
